﻿Public Class CustomButton
    Inherits Button

    Dim vFunc As Integer

    Public Property Func() As Integer
        Get
            Return vFunc
        End Get
        Set(ByVal value As Integer)
            vFunc = value
        End Set
    End Property

    Public Sub New()

    End Sub

    Private Sub DoFunction()
        Select Case Func
            Case 0
                If (MsgBox("Are you sure want to quit ?", MsgBoxStyle.YesNo, "Exit Confirmation") = MsgBoxResult.Yes) Then
                    Application.Exit()
                End If
            Case 1
                If (MsgBox("Restart game ?", MsgBoxStyle.YesNo, "Restart Confirmation") = MsgBoxResult.Yes) Then
                    DialogResult = Windows.Forms.DialogResult.Retry
                End If
                'Restart Goes Here
            Case Else

        End Select
    End Sub

    Private Sub CustomButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
        DoFunction()
    End Sub
End Class
